#include<bits/stdc++.h>

using namespace std;
char a[1 << 30];//global array
int main() {
    int n = 0, m = 3;
    int *p = (int *) malloc(sizeof(int) * m);
    int x;
    while (cin >> x) {
        if (n >= m) {
            //double space
            cout << "double space!!!" << endl;
            m *= 2;
            int *q = (int *) malloc(sizeof(int) * m);
            for (int i = 0; i < n; i++)q[i] = p[i];
            free(p);
            p = q;
        }
        p[n++] = x;
    }
    for (int i = 0; i < n; i++) {
        cout << p[i] << " ";
    }

    free(p);
    p = NULL;
}
